package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.DamageDao;
import com.atguigu.jxc.entity.*;
import com.atguigu.jxc.service.DamageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DamageServiceImpl implements DamageService {

    @Autowired
    private DamageDao damageDao;

    @Override
    public void save(DamageList damageList, String damageListGoodsStr) {

        this.damageDao.saveDamage(damageList, damageListGoodsStr);
    }

    @Override
    public Map<String, Object> list(String sTime, String eTime) {
        List<DamageList> damageList = damageDao.list(sTime, eTime);
        Map<String, Object> map = new HashMap<>();
        map.put("rows", damageList);
        return map;
    }

    @Override
    public Map<Object, Object> getListById(Integer damageListId) {
        //通过Id获取报损单的列表
        List<DamageListGoods> OverflowListGoods = damageDao.getListById(damageListId);
        Map<Object, Object> map1 = new HashMap<>();
        map1.put("rows", OverflowListGoods);
        return map1;
    }

}
